const { resolve } = require('path')
const { defineConfig, searchForWorkspaceRoot } = require('vite')

module.exports = defineConfig({
  mode: 'production',
  server: {
    open: '/axlib-jsbox/axlib-jsbox-v2.js'
  },
  build: {
    minify: 'terser',
    emptyOutDir: true,
    rollupOptions: {
      input: {
        'axlib-v3':          resolve(__dirname, 'axlib/axlib-v3.js'),
        'axlib-lottie':      resolve(__dirname, 'axlib-lottie/axlib-lottie.js'),
        'axlib-jsbox-v2':    resolve(__dirname, 'axlib-jsbox/axlib-jsbox-v2.js'),
        'axlib-animebox-v2': resolve(__dirname, 'axlib-animebox/axlib-animebox-v2.js'),
      },
      output: {
        dir: resolve(__dirname, 'dist'),
        entryFileNames: '[name].min.js'
      }
    }
  }
})